package designPattern;

public class ProxyPattern {
    public static void main(String[] args) {
        Star realStar = new ProxyStar(new RealStar());
        realStar.sing();
    }
}

interface Star {
    void sing();
}

class RealStar implements Star {
    @Override
    public void sing() {
        System.out.println("Super star singing");
    }
}

class ProxyStar implements Star {
    private Star realStar;

    ProxyStar(Star realStar) {
        this.realStar = realStar;
    }

    @Override
    public void sing() {
        System.out.println("before sing");
        realStar.sing();
        System.out.println("after sing");
    }
}